package org.brisling.oa.queryService;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.http.HttpServletResponse;

import org.brisling.base.domain.ChartDomain;
import org.brisling.base.domain.ListDomain;
import org.brisling.base.domain.RetDomain;
import org.brisling.common.ConstSysParam;
import org.brisling.oa.domain.OAAssetPurchaseOver;
import org.brisling.oa.queryService.base.AbstractOAQueryService;
import org.brisling.sysman.queryService.QueryDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
 * <p>Title: QueryOAAssetPurchaseOverService</p>
 * <p>Description: 大型资产采购查询服务类</p>
 * <p>Company: tongking</p>
 * @author jackson wang
 * @since 1.0
 * @version 1.0
 * @date 2019年07月02 09:40:33
 */
@RestController
@RequestMapping("/oaAssetPurchaseOver/query")
public class QueryOAAssetPurchaseOverService extends AbstractOAQueryService<OAAssetPurchaseOver> {
	
	
	
	
	@Autowired
	private QueryDictionaryService dicService;


	//模块业务编码
	private String moduleCode = "oaAssetPurchaseOver";
	
	private String wordName = "大型资产采购审批单";
		
	
	
	public QueryOAAssetPurchaseOverService(){
		this.moduleName = ConstSysParam.MODULE_OA_ASSETPURCHASE_OVER;
		this.subSystem = ConstSysParam.SUBSYSTEM_OA;
		this.tableName = ConstSysParam.VIEW_PREFIX +this.moduleName;
		this.clazz = OAAssetPurchaseOver.class;
		
		typeMap = this.getTypeMap(clazz);
		
//		orderMap.put("bizno",null);
		
		
	}
	
	@PersistenceContext(unitName=ConstSysParam.SUBSYSTEM_SYSMAN)
	@Autowired
	protected void setEntityManager(EntityManager entityManager){
		this.entityManager = entityManager;		
	}
	
	@RequestMapping("/mainPage.action")
	public ModelAndView getMainPage(){
		return this.getBizMainPage();
	}
	
	
	/* (non-Javadoc)
	 * @see org.brisling.service.sysman.DepartmentServiceInf#getEditPage()
	 */
	@RequestMapping("/editPage.action")
	public ModelAndView getEditPage(){
		return this.getBizEditPage();
	}
		
	
	@RequestMapping("/getListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getListDomain(
			@RequestBody(required=false) String body){		
		
		return super.getListDomain(body);
	}
	
	@RequestMapping("/getOperateTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getUserCanoperateTask(@RequestBody(required=false) String body){
		return super.getUserCanoperateTask(body);
	}
	
	@RequestMapping("/getSignedTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getUserSignedTask(@RequestBody(required=false) String body){
		return super.getUserSignedTask(body);
	}
	
	@RequestMapping("/getUnsignedTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getUserUnsignedTask(@RequestBody(required=false) String body){
		return super.getUserUnsignedTask(body);
	}
	
	
	@RequestMapping("/getFinishedTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getUserFinishedTask(@RequestBody(required=false) String body){
		return super.getUserFinishedTask(body);
	}
	
	
	@RequestMapping("/getAllTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getAllTask(@RequestBody(required=false) String body){
		return super.getAllTask(body);
	}
	
	@RequestMapping("/getUserManagedTaskDomain.action")
	public ListDomain<OAAssetPurchaseOver> getUserManagedTask(@RequestBody(required=false) String body){
		return super.getUserManagedTask(body);
	}
	
	@RequestMapping("/exportExcel.action")
	public void exportExcel(@RequestBody(required=false) String body,HttpServletResponse response){
		String title = "设备采购";
		String sqlid = "medical_inquiry_export";
		super.exportExcel(body, response,title,sqlid);
	}
	
	
	@RequestMapping("/getTaskListDomain.action")
	public ListDomain<OAAssetPurchaseOver> getTaskListDomain(@RequestBody(required=false) String body){
		
		
		return super.getTaskListDomain(body);
	}
	
	/**
	 * 获取任务数量
	 * @return
	 */
	@RequestMapping("/getTaskCnt.action")
	public List<ChartDomain> getTaskCnt(@RequestBody(required=false) String body){
		
		return super.getTaskCnt(body);
		
	}
	
	
	/**
	 * 根据记录id查找单条业务记录
	 * @param id	用户id
	 * @return      业务记录 
	 */
	@RequestMapping("/getOne.action")
	public OAAssetPurchaseOver getOne(@RequestParam(value="id",required=false) Long id){
		return super.getOne(id);
	}
	
	/**
	 * 根据业务唯一编码查找单条业务记录
	 * @param identify	业务记录唯一编码
	 * @return			业务记录
	 */
	@RequestMapping("/getOneByIdentify.action")
	public OAAssetPurchaseOver getOneByIdentify(@RequestParam(value="identify",required=false) String identify){	
		return super.getOneByIdentify(identify);
	}
	
	/**
	 * 根据指定字段及字段值查找单条业务记录
	 * @param field		查询字段名称
	 * @param fieldVal	查询字段值
	 * @return			单条业务记录
	 */
	@RequestMapping("/getOneByField.action")
	public OAAssetPurchaseOver getOneByField(@RequestParam(value="field",required=false) String field,
			@RequestParam(value="fieldVal",required=false) String fieldVal){	
		return super.getOneByIdentify(field,fieldVal);
	}
	
	
	/**
	 * 根据指定字段名及字段值查找记录
	 * @param field		字段名
	 * @param fieldVal	字段值
	 * @return
	 */
	@RequestMapping("/getOneByBizTable.action")
	public OAAssetPurchaseOver getOneByBizTable(@RequestParam(value="field",required=false) String field,
			@RequestParam(value="fieldVal",required=false) String fieldVal){	
		return super.getOneByTable(field,fieldVal);
	}
	
	
	
	/**
	 * 返回流程记录流程实例的执行记录
	 * @param body	包含procInstId在内的参数信息
	 * @return
	 */
	
	@RequestMapping("/flowHistoricsListDomain.action")
	public ListDomain<Object> getHistoricByProcInstId(@RequestBody(required=false) String body){
		
		String sql = dicService.getSqlByBizcode("flow_historics");				
		return super.getHistoricByProcInstId(body, sql);
	}
	
	public String generateBizno(){
		return super.generateBizno();
	}
	
	
	
	

	public List<OAAssetPurchaseOver> getAllList(String sql){
		return super.getAllList(sql);
	}

	/**
	 * 导出word表单
	 * @param id	记录id
	 * @return 		导出执行结果 
	 */
	@RequestMapping("/exportWord.action")
	public RetDomain exportWord(@RequestParam(value="id",required=false) Long id,HttpServletResponse response){
		return super.exportWord(id, moduleCode, response,wordName);
	}
	
}
